<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-3.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">

  <head>
    <title>Good Thymes Virtual Grocery</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <script src="../assets/js/jquery.js"></script>
    <script src="../assets/js/bootstrap-dropdown.js"></script>
	<script src="../assets/js/bootstrap-collapse.js"></script>
    <div th:remove="tag" th:include="navbar::head"></div>
  </head>

  <body th:object="${order}">
	<div th:include="navbar::copy" th:remove="tag"></div>
    
  	
  	<div class="container">
  	<div class="row">
  	<div class="span6">
	    <h2>Order details</h2>
	
	    <div>
	      <p><b>Code:</b> <span th:text="*{id}">99</span></p>
	      <p><b>Date:</b> <span th:text="*{#calendars.format(date,'dd MMM yyyy')}">13 jan 2011</span></p>
	    </div>
    </div>
    
    <div class="span6">
	    <h2>Customer</h2>
	      
	    <div th:object="*{customer}">
	      <p><b>Name:</b> <span th:text="*{name}">Frederic Tomato</span></p>
	      <p><b>Since:</b> <span th:text="*{#calendars.format(customerSince,'dd MMM yyyy')}">13 jan 2011</span></p>
	    </div>
    </div>
    
    <div class="span12">
    <h2>Products</h2>
  
    <table class="table">
      <thead>
      <tr>
        <th>PRODUCT</th>
        <th>AMOUNT</th>
        <th>PURCHASE PRICE</th>
      </tr>
      </thead>
      <tbody>
      <tr th:each="ol,row : *{orderLines}" th:class="${row.odd}? 'odd'">
        <td th:text="${ol.product.name}">Strawberries</td>
        <td th:text="${ol.amount}" class="number">3</td>
        <td th:text="${ol.purchasePrice}" class="number">23.32</td>
      </tr>
      </tbody>
    </table>
	
    <div>
      <b>TOTAL:</b> <span th:text="*{#aggregates.sum(orderLines.{purchasePrice * amount})}">35.23</span>
    </div>
  	</div>
    </div>
    </div>
  </body>
  
</html>

